import { Button, Flex, Heading, PasswordField, TextField, View, } from '@aws-amplify/ui-react'; import { PasswordFieldDemo } from './demo'; import { Example, ExampleCode } from '@/components/Example'; import { Fragment } from '@/components/Fragment'; import { ComponentClassTable } from '@/components/ComponentClassTable'; import StandardHTMLAttributes from '@/components/StandardHTMLAttributes.mdx'; import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay'; import ThemeExample from '@/components/ThemeExample.mdx'; import { ChangePasswordFormExample, DefaultPasswordFieldExample, DescriptiveTextExample, HidePasswordFieldExample, IsRequiredExample, LabelHiddenExample, LoginFormExample, MaxLengthExample, PasswordFieldStyledPropsExample, PasswordFieldThemeExample, RefExample, RequiredPasswordFieldExample, ShowPasswordButtonExample, SignUpFormExample, SizeExample, ValidationErrorExample, VariationExample, } from './examples'; ## Demo ## Usage Import the `PasswordField` component and provide a `label` for accessibility/usability. ```jsx file=./examples/DefaultPasswordFieldExample.tsx ``` ### Hiding the show password button Use the `hideShowPassword` prop to hide the show password button. ``` jsx file=./examples/HidePasswordFieldExample.tsx ``` ### Autocomplete - supporting password managers Use the `autoComplete` prop to tell browser how to populate a password field. Options for `autoComplete` are `current-password` (default) and `new-password`. If customers are logging in, setting `autoComplete` is not required because `current-password` is the default. If customers are signing up for a new account, set `autoComplete` to `new-password`. See [MDN for more information on autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete). _Signup form example: `new-password`_ ```jsx file=./examples/SignUpFormExample.tsx ``` _Login form example: `current-password` (default)_ ```jsx file=./examples/LoginFormExample.tsx ``` _Change password example: `current-password` and `new-password`_ ```jsx file=./examples/ChangePasswordFormExample.tsx ``` ### Accessibility / Label behavior {() => import('./../shared/formFieldAccessibility.mdx')} ```jsx file=./examples/LabelHiddenExample.tsx ``` #### ShowPasswordButton The ShowPasswordButton renders a `